/**
 * Created by Ji.wenjiang on 2016/8/30.
 */

angular.module('inspinia')
  .controller('imageViewCtrl',function ($scope) {
    var picIndex=1;

    // $(window).resize(function () {          //当浏览器大小变化时
    //   $(".heightWith").attr('height',document.body.clientHeight-59);
    //   console.log(document.body.clientHeight-59);
    // });

    // $scope.$watch($scope.totalCart, calculateDiscount);
    // window.addEventListener('clicdocument.documentElement.clientHeightnt_H', juege, false);
    // function juege() {
    //   console.log("1234");
    // }
    // $scope.$watch('',function(newValue,oldValue, scope){
    //
    //   console.log(newValue);
    //
    //   console.log(oldValue);
    //
    // });
    // console.log(clicnt_H);
    $('body').addClass('mini-navbar');
    var scrollFunc=function(e){
      console.log("index44:"+e);
      e=e || window.event;
      var _value=0;
      if(e.wheelDelta){//IE/Opera/Chrome
        _value=e.wheelDelta;
      }else if(e.detail){//Firefox
        _value=e.detail;
      }
      var index = _value%16;
      if (index > 1) {
        picIndex += 1;
      }else{
        picIndex -= 1;
      }
      picIndex=Math.abs(picIndex%16);
      console.log("picIndex:"+picIndex);
      $("#centerImage").attr("src","assets/images/imageView/"+picIndex+".jpg")

    }



    /*注册鼠标滚轮事件*/
    if(document.addEventListener){
      document.addEventListener('DOMMouseScroll',scrollFunc,false);
    }//W3C
    window.onmousewheel=document.onmousewheel=scrollFunc;//IE/Opera/Chrome
  })
